<%@page contentType="text/html; charset=utf-8" %>
<%@ include file="/commons/taglibs.jsp"%>
<%@ taglib uri="/WEB-INF/tld/pms-tag.tld" prefix="mypms" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>

<link href="${ctx}/styles/listTable.css" rel="stylesheet" type="text/css">
<link href="${ctx}/styles/grid.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/listTable.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/public.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/global.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/common.js"></script>
<%@ include file="/commons/dateTime.jsp" %>
<%@ include file="/commons/validation.jsp" %>

<link rel="stylesheet" type="text/css" href="${ctx}/styles/public.css" />
<script language="javascript" src="${ctx}/scripts/public.js"></script>
<script type="text/javascript">
	var ACTION_URL="${ctx}/customer_callInPersonAction.do?";
	function openNewWindow(){
		var url=ACTION_URL + "method=initCallInPersonAdd";
		top.windowOpen(url, 'houseChoose', '登记来访人员', 550, 450,false,'houseChoose');
	}

	function openEditWindow(){
		if(getEdit_guestRecordId()!="" && getEdit_guestRecordId() != undefined){
			var url=ACTION_URL + "method=initCallInPersonEdit&guestRecordId="+getEdit_guestRecordId();
			top.windowOpen(url, 'houseChoose', '修改来访人员', 550, 450,false,'houseChoose');
		}else{
			Alert("修改之前请先选择记录");
		}
	}

	function search(){
		var flag = $("fSearch").fireEvent("onsubmit");
	    if(!flag) return;
		var url= ACTION_URL + "method=callInPersonList";
		$('fSearch').action=url;
		$('fSearch').submit();
	}

	function initIframeURL(){
		var url= ACTION_URL + "method=initCallInPersonList";
		$('callInPersonList').src=url;
	}
	//来访人员详细信息
	function showDetail(){
		var url=ACTION_URL + "method=initCallInPersonDetail&guestRecordId="+getEdit_guestRecordId();
		top.windowOpen(url, 'in', '来访人员详细信息', 900, 590);
	}
	//删除来访人员信息
	function showDelete(){
		var url=ACTION_URL + "method=deleteCallInPerson&callInPersonId="+getEdit_guestRecordId();
		if(getEdit_guestRecordId()==""){
			Alert("请先选择您要删除的记录");
		}else{
			var result=confirm("你确定删除此条记录吗？")
			if(result){
				deleteCallInPerson(url);
			}
		}
	}

	//执行操作
	function deleteCallInPerson(url){
		var myAjax = new Ajax.Request(
	                   url,
	                   {method: 'post', parameters:"" , onComplete: showResponseDelete}
	                   );
	}

	function showResponseDelete(transport){
		if(transport.responseText=="false"){
			Alert("删除失败");
		}else{
			reLoadIFrameListWithQuery();
		}
	}
	//重新加载列表页面,不保留条件的刷新
	function reLoadIFrameList(){
		var url= ACTION_URL + "method=callInPersonList";
		$('callInPersonList').src=url;
	}

	//重新加载列表页面,保留查询条件的刷新
	function reLoadIFrameListWithQuery(){
		window.frames("callInPersonList").freshFrame();
	}

	//垃圾方法,待检查
	var clickednun=0;
	function disright(yesorno)
	{
		if(yesorno=="yes"&&clickednun==0)
		{
			document.getElementById("ifra_right").style.display="";
			clickednun=1;
		}else{
			document.getElementById("ifra_right").style.display="none";
			clickednun=0;
		}
	}
	//获取当前选择的记录
	function getEdit_guestRecordId(){
		var obj=document.frames("callInPersonList").document.all;
		return obj.edit_guestRecordId.value;
	}
</script>
</head>

<body  onload="initIframeURL();" onkeydown="if(event.keyCode==13)btn1_12.onclick();">
<div style="overflow:auto; height:500px;">
<form action="" method="post" id="fSearch" target="callInPersonList" class="required-validate">
<input type="hidden" name="isShowMenu" value="${isShowMenu}">
<input type="hidden"  name="houseNumber" value="${houseNumber}">
<!-- 主线界面公用这个页面,如果是主线界面,这部分不显示,用isShowMenu表示 -->
<c:if test="${isShowMenu}">
<div class="pageNav_bg">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td id="pageNav_leftimg"><img src="${ctx}/images/ico_custome_household.gif" width="46" height="47"/></td>
      <td id="navWord"><span class="page_title">来访人员管理</span></td>
      <td class="pageNav_right"><a href="javascript:showFull_in();"><img id="full_image"  src="${ctx}/images/ico_fullscreen.gif" border="0"/></a></td>
    </tr>
  </table>

</div>
</c:if>
<div class="container">
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
      <td class="bg_search"><table border="0" cellpadding="0" cellspacing="1">
        <tr>
          <td class="td_search">姓名：</td>
		  <td class="td_search"><input name="customerName" type="text" class="inputtext" size="16"></td>
		  <td class="td_search">来访时间：</td>

		  <td class="td_search"><table border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><input name="callInStartDate" type="text" class="inputtext validate-dateTime-yyyy-mm-dd-HH:mm" afterInsert="callInMsg" value="" size="16"></td>
              <td width="4">&nbsp;</td>
              <td>
              		<a href="#">
              			<img id="callInStartDateButton" src="${ctx}/images/ico_clock.gif" alt="请点选查找日期" border="0">
              		</a>
              		<span id="callInMsg"></span>
              </td>
            </tr>
          </table></td>
		  <td >到</td>

		  <td class="td_search"><table border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><input name="callInEndDate" type="text" class="inputtext validate-dateTime-yyyy-mm-dd-HH:mm" afterInsert="callInEndMsg" value="" size="16"></td>
              <td width="4">&nbsp;</td>
              <td>
              		<a href="#">
              			<img id="callInEndDateButton" src="${ctx}/images/ico_clock.gif" alt="请点选查找日期" border="0">
              		</a>
              		<span id="callInEndMsg"></span>
              </td>
            </tr>
          </table></td>
		  <td class="td_search"><table border="0" cellpadding="0" cellspacing="0">
            <tr>

              <td class="buttonOffLeft" id="btn1_11"></td>
              <td class="buttonOffMiddle" id="btn1_12" onclick="search()" onblur="btn_change(1)" onMouseOver="btn_change_over(1)" onMouseOut="btn_change_out(1)"><img src="${ctx}/images/ico_searchico.gif" alt="" border="0" align="absmiddle"> 查
                询</td>
              <td class="buttonOffRight" id="btn1_13"></td>
            </tr>
          </table></td>
          </tr>
      </table></td>
    </tr>
    <tr>
      <td ><!-------------------------->
          <table width="100%" border="0" cellpadding="0" cellspacing="0">
<!-- 主线界面公用这个页面,如果是主线界面,这部分不显示,用isShowMenu表示 -->
<c:if test="${isShowMenu}">
            <tr>
              <td class="bg_toolBar"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="40%">&nbsp;</td>
                  <td width="60%" align="right">
                    <table border="0" cellpadding="0" cellspacing="0" id="ico1">
                      <tr>
                      <pms:AuthTag authName="customer_callInPersonAction.do?method=initCallInPersonAdd">
                        <td class="toolbarico"><a href="#"  onClick="openNewWindow();"onFocus="this.blur()"><img src="${ctx}/images/ico_newfile.gif" border="0" align="absbottom" alt="新建"/></a></td>
                        </pms:AuthTag>
                        <pms:AuthTag authName="customer_callInPersonAction.do?method=initCallInPersonEdit">
                        <td  class="toolbarico"><a href="#" onFocus="this.blur()" onClick="openEditWindow();"><img src="${ctx}/images/ico_amend.gif" alt="修改" width="16" height="16" border="0" align="absbottom" /></a></td>
                     </pms:AuthTag>
                     <pms:AuthTag authName="customer_callInPersonAction.do?&method=deleteCallInPerson">
                     <td class="toolbarico"><a href="#" onClick="showDelete();" onFocus="this.blur()"><img src="${ctx}/images/ico_delete.gif" alt="删除" width="16" height="16" border="0" align="absbottom"></a></td>
                      </pms:AuthTag>
                      </tr>
                    </table></td>

                </tr>
              </table></td>
            </tr>
  </c:if>
            <tr>
              <td valign="top">
				<iframe  id="callInPersonList" height="400PX"  name="callInPersonList" frameborder="0" border="0" src="" width="100%" ></iframe>
			</td>

    </tr>
  </table>
</div>
</form>

<script type="text/javascript">
              Calendar.setup(
              {
	              inputField : "callInStartDate", // ID of the input field
	              ifFormat : "%Y-%m-%d %H:%M", // the date format
	              button : "callInStartDateButton", // ID of the button
	              align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true,
			      showsTime		 :	  true
              }
              );

              Calendar.setup(
              {
	              inputField : "callInEndDate", // ID of the input field
	              ifFormat : "%Y-%m-%d %H:%M", // the date format
	              button : "callInEndDateButton", // ID of the button
	              align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true,
			      showsTime		 :	  true
              }
              );

</script>
</div>
</body>
</html>
